package com.njitt.demo.controller;

import com.njitt.demo.pojo.User;
import com.njitt.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/v1/user",method = {RequestMethod.GET,RequestMethod.POST})
public class MybatisController {

    @Autowired
    private UserService UserService;

    @GetMapping("/query")
    public List<User> queryUserList(){
        List<User> users = UserService.queryUserList();
        return users;
    }

    /**
     * Json接口：获取所有用户信息
     * @return
     */
    @RequestMapping("queryAllUser")
    @ResponseBody
    public List<User> queryAllUser(){
        return UserService.queryUserList();
    }
}
